import java.util.*;
public class Main{
    public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);
        String str = scanner.nextLine();
        char[] arr = str.toCharArray();
        Stack<Character> stack = new Stack<>();
        for(int i = 0; i < arr.length; i++){
            if(stack.isEmpty()){
                stack.push(arr[i]);
                continue;
            }
            char temp = stack.peek();
            if(arr[i] == temp){
                stack.pop();
            }
        }
        List<Character> list = new ArrayList<>(stack);
        if(list.isEmpty()){
            System.out.println(0);
        }else{
            System.out.println(list.toString());
        }
    }
}